package demoMod.stsconsole.powers;

import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.helpers.DamageInfo;
import demoMod.stsconsole.interfaces.InflictSubscriber;

public class CurlUpPower extends AbstractPower implements InflictSubscriber {
    public static final String  ID = "CurlUpPower";

    public CurlUpPower(AbstractCreature owner, int amount) {
        super(ID, owner, amount);
    }

    @Override
    public String getUpdatedDescriptions() {
        return String.format(this.description, this.amount[0]);
    }

    @Override
    public void onInflictDamage(DamageInfo info, AbstractCreature target) {
        if (target == this.owner && info.type == DamageInfo.DamageType.NORMAL) {
            this.owner.gainBlock(this.amount[0]);
            this.onRemove();
        }
    }
}
